package com.ruoyi.core.service.impl;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.core.domain.USuggest;
import com.ruoyi.core.mapper.USuggestMapper;
import com.ruoyi.core.service.SuggestService;
import com.ruoyi.core.vo.SuggestCreateVo;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @Author xiaom
 * @Date 2021/6/5 10:09
 * @Version 1.0.0
 * @Description <>
 **/
@Service
public class SuggestServiceImpl implements SuggestService {

    @Resource
    private USuggestMapper uSuggestMapper;

    @Override
    public void add(SuggestCreateVo suggestCreateVo) {
        USuggest uSuggest = new USuggest();
        BeanUtils.copyBeanProp(uSuggest,suggestCreateVo);
        uSuggest.setCreateTime(new Date());
        uSuggest.setUserId(SecurityUtils.getLoginUser().getUser().getUserId());
        uSuggestMapper.insert(uSuggest);
    }
}
